import java.util.Scanner;

class TreeNode{
    char val;
    TreeNode left;
    TreeNode right;

    public TreeNode(char val){
        this.val = val;
    }
}

public class demo01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextLine()){
            String str = scanner.nextLine();
            TreeNode root = createTree(str);
            inorder(root);
        }
    }

    public static int i = 0;
    private static TreeNode createTree(String str){
        TreeNode root = null;
        char ch = str.charAt(i);
        if(ch!='#'){
            root = new TreeNode(ch);
            i++;
            TreeNode left = createTree(str);
            TreeNode right = createTree(str);
        }else {
            i++;
        }
        return root;
    }

    private static void inorder(TreeNode root){
        if(root == null) return;
        inorder(root.left);
        System.out.print(root.val);
        inorder(root.right);
    }
}
